#ifndef _edaParWrapperControl_h_
#define _edaParWrapperControl_h_

#include <map>
#include <vector>

using namespace std;

#include "edaSearch.h"
#include "edaDAG.h"
#include "edaDefine.h"
#include "edaParSearchWrapper.ph"

class edaParWrapperControl
{
 public:
  edaParWrapperControl();
  int insertVertex(edaSearch *sa);
  int insertEdge(const int from, const int to);
  bool search(edaSolution &sol);
  
  /*
   * Waiting for status change
   *
   * \return task ID that has status changed
   */
  int polling(map<int, edaParSearchWrapper*> &taskWrapper);

 private:
  vector<int> findReadyNodes();
  bool allDone();
  
  edaDAG<edaSearch*> taskDAG;
  map<int, int> taskStatus;
  int edgeNum;
  int vertexNum;

//  classuid(1000);
};

#endif
